package com.infitecs.eyas.mill.service;

import com.infitecs.eyas.constant.Constant;
import com.infitecs.eyas.mill.dao.SystemHeatDao;
import com.infitecs.eyas.mill.model.SystemHeat;
import com.infitecs.eyas.session.SessionService;
import com.infitecs.eyas.session.model.Param;
import com.infitecs.eyas.step.modal.StepInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Administrator on 2015/6/28 0028.
 */
@Service
public class SystemHeatService {
    @Autowired
    private SystemHeatDao systemHeatDao;

    @Autowired
    private SessionService sessionService;

    public SystemHeat getSystemHeat() {
        return systemHeatDao.getSystemHeat(sessionService.getCaseId());
    }

    public void addSystemHeat() {
        int caseId = sessionService.getCaseId();
        systemHeatDao.addSystemHeat(caseId);
        sessionService.addStepState(new StepInfo(caseId, Constant.STEP_ID_13, Constant.STEP_OVER_STATE_0));
    }

    public void saveValueOfSystemHeat(Param param) {
        param.setCaseId(sessionService.getCaseId());
        systemHeatDao.saveValueOfSystemHeat(param);
        param.setParamName(sessionService.getE() + param.getParamName());
        sessionService.putParamMap(param);
    }

}
